package com.onlyphoto.onlymall.mvp.model

import com.onlyphoto.onlymall.api.Urls
import com.onlyphoto.onlymall.base.BaseEntity
import com.onlyphoto.onlymall.base.BaseModel
import com.onlyphoto.onlymall.base.BaseObserver
import com.onlyphoto.onlymall.bean.request.ConfirmReceiveBean
import com.onlyphoto.onlymall.bean.response.OrderDetailsBean
import com.onlyphoto.onlymall.utils.ConfigUtil
import com.onlyphoto.onlymall.utils.RxTransformer


class MOrderDetailsImpl : BaseModel() {
    var url = ""
    fun requestOrderDetails(getType : Int, orderId: Int, baseObserver: BaseObserver<OrderDetailsBean>){
        url = ConfigUtil.instance.getUrl(Urls.GOODS_ORDER)
        apiService().getOrderDetails(url, getType, orderId)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }

    fun confirmReceice(bean: ConfirmReceiveBean, baseObserver: BaseObserver<BaseEntity>){
        url = ConfigUtil.instance.getUrl(Urls.GOODS_ORDER)
        apiService().confrimReceive(url, bean)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }

    fun getUploadedPic(orderId: String, goodsId: String, baseObserver: BaseObserver<ArrayList<String>>){
        url = ConfigUtil.instance.getUrl(Urls.CUSTOM_IMG)
        apiService().getUpLoadedPic(url, orderId, goodsId)
                .compose(RxTransformer.switchSchedulers(this))
                .subscribe(baseObserver)
    }
}
